/**
 * OfdPackageApis.ts
 * 套餐 接口调用
 */

import { request } from "@/http/axios"
import { IdParam, PageParam, SearchSortPageParam, PageResult, ValueResult } from "@@/types/http"
import type * as Models from "@/types/OfdPackage.ts"

/**
 * 增
 * @param data
 * @returns
 */
export function add(data: Models.OfdPackageCreateOrUpdateParam) {
  return request<HttpResult<ValueResult<boolean>>>({
    url: "/api/ofd/package/add",
    method: "post",
    data
  })
}

/**
 * 删
 * @param data
 * @returns
 */
export function remove(data: IdParam<number>) {
  return request<HttpResult<ValueResult<boolean>>>({
    url: "/api/ofd/package/remove",
    method: "post",
    data
  })
}

/**
 * 改
 * @param data
 * @returns
 */
export function update(data: Models.OfdPackageCreateOrUpdateParam) {
  return request<HttpResult<ValueResult<boolean>>>({
    url: "/api/ofd/package/update",
    method: "post",
    data
  })
}

/**
 * 查询所有数据列表
 * @param data
 * @returns
 */
export function findAll() {
  return request<HttpResult<Array<Models.OfdPackageResult>>>({
    url: "/api/ofd/package/findAll",
    method: "post",
    data: {}
  })
}

/**
 * 分页查询
 * @param data
 * @returns
 */
export function findPage(data: PageParam) {
  return request<HttpResult<PageResult<Models.OfdPackageResult>>>({
    url: "/api/ofd/package/findPage",
    method: "post",
    data
  })
}

/**
 * 搜索排序分页
 * @param data
 * @returns
 */
export function search(data: SearchSortPageParam<Models.OfdPackageSearchParam, Models.OfdPackageOrderParam>) {
  return request<HttpResult<PageResult<Models.OfdPackageResult>>>({
    url: "/api/ofd/package/searchSortPage",
    method: "post",
    data
  })
}

/**
 * 增(备用)
 * @param data
 * @returns
 */
export function addData(data: Models.OfdPackageCreateOrUpdateParam) {
  return request<HttpResult<ValueResult<boolean>>>({
    url: "/api/ofd/package/add",
    method: "post",
    data
  })
}

/**
 * 改(备用)
 * @param data
 * @returns
 */
export function updateData(data: Models.OfdPackageCreateOrUpdateParam) {
  return request<HttpResult<ValueResult<boolean>>>({
    url: "/api/ofd/package/update",
    method: "post",
    data
  })
}
